package de.justphil.tcg.tcgserver.game.mechanics.event;

import de.justphil.tcg.tcgserver.commons.exceptions.TCGException;

/**
 * 
 * @author Martin
 * 
 */

public interface Scheduler {

	/**
	 * Gets the remaining time to a scheduled event.
	 * 
	 * @param event
	 *            the event to search for
	 * @return The time to the first equal event or -1.0 if no such event is
	 *         scheduled.
	 */
	double getTimeToEvent(Event event);

	/**
	 * Gets the recent time.
	 * 
	 * @return the recent time
	 */
	double getTotalTime();

	/**
	 * Schedules an event as first for the specified time.
	 * 
	 * @param event
	 *            the event to schedule
	 * @param relativeTime
	 *            the relative time starting from the recent time.
	 */
	public void scheduleFirst(Event event, double relativeTime) throws TCGException;

	/**
	 * Schedules an event as last for the specified time.
	 * 
	 * @param event
	 *            the event to schedule
	 * @param relativeTime
	 *            the relative time starting from the recent time.
	 */
	public void scheduleLast(Event event, double relativeTime) throws TCGException;

	/**
	 * Schedules an event directly and disrupts the current proceeding.
	 * 
	 * @param event
	 *            the event to schedule
	 */
	public void scheduleNow(Event event) throws TCGException;

	/**
	 * Removes the scheduling of an event
	 * 
	 * @param event
	 * @return Returns true for success and false otherwise.
	 */
	public boolean unschedule(final Event event);

}
